<?php

namespace Module\DataAliyunOss\Admin\Controller;

use Illuminate\Routing\Controller;
use ModStart\Admin\Layout\AdminConfigBuilder;

class ConfigController extends Controller
{
    public function index(AdminConfigBuilder $builder)
    {
        $builder->pageTitle('阿里云OSS存储');
        $builder->switch('DataAliyunOss_Enable', '启用阿里云OSS');
        $builder->text('DataAliyunOss_Domain', 'Bucket域名')
            ->help('如果您的OSS开启了CDN加速，可直接配置CDN域名（如 http://cdn.example.com）')
            ->ruleUrl();
        $builder->text('DataAliyunOss_AccessKeyId', 'AccessKeyId');
        $builder->text('DataAliyunOss_AccessKeySecret', 'AccessKeySecret');
        $builder->text('DataAliyunOss_Endpoint', 'Endpoint')
            ->help('格式为 oss-cn-xxx.aliyuncs.com');
        $builder->text('DataAliyunOss_Bucket', 'Bucket');
        $builder->formClass('wide');
        return $builder->perform();
    }
}
